package com.example.newapplication;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.widget.Toast;

public class dialogGenerator extends Activity{

	
	private Toast  toast;
	private String text,titleText;
	private static final int DIALOG_DUMMY = 1;
	private Context context;
  	
  	@SuppressWarnings("deprecation")
  	
	public dialogGenerator(Context context, String messageText,String titleText){
  		this.text = messageText;
  		this.context = context;
  		this.titleText = titleText;
  		this.showDialog(DIALOG_DUMMY);
  	}
  	
  	
  
  	
  	public dialogGenerator(Context context,String messageText,Boolean ifToast){
  		this.text  = messageText;
  		this.context = context;
  		this.toast = Toast.makeText(context, this.text, Toast.LENGTH_LONG);
  		this.toast.show();
  	}
  	
	 public Dialog onCreateDialog(int id) {
	    	AlertDialog.Builder db = new AlertDialog.Builder(context);
	    	db.setTitle(titleText);
	    	db.setMessage(this.text);
	    	db.setPositiveButton("OK", new OnClickListener() {
	    		public void onClick(DialogInterface dialog, int id) {}
	    	});
	    	
	    	return db.create();
	  }
	  public void onPrepareDialog(int id, Dialog dialog) {
	    	
	  }
}
